
from PyQt6.QtCore import Qt, QThread, pyqtSignal
from pynput import keyboard

class GlobalKeyListener(QThread):
    key_released = pyqtSignal(object)

    def run(self):
        def on_release(key):
            if key == keyboard.Key.ctrl_r:
                self.key_released.emit(key)

        with keyboard.Listener(on_release=on_release) as listener:
            listener.join()